<?php
namespace App\Model;
use EasySwoole\ORM\AbstractModel;
use EasySwoole\ORM\Utility\Schema\Table;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/11/1 0001
 * Time: 15:38
 * Class MypicModel
 * @property $id
 * @property $userid
 * @property $filename
 * @property $filehash
 * @property $fileurl
 * @property $filethumb
 * @property $size
 * @property $source
 * @property $created_at
 * @property $updated_at
 */

class MypicModel extends AbstractModel
{
    /**
     * 表的获取
     * 此处需要返回一个 EasySwoole\ORM\Utility\Schema\Table
     * @return Table
     */
    public function schemaInfo(bool $isCache = true): Table
    {
        $table = new Table('filedata');
        $table->colInt('id')->setIsPrimaryKey(true);
        $table->colInt('userid');
        $table->colChar('filename', 255);
        $table->colChar('filehash', 255);
        $table->colChar('fileurl', 255);
        $table->colChar('filethumb', 255);
        $table->colInt('size');
        $table->colInt('source');
        $table->colDateTime('created_at');
        $table->colDateTime('updated_at');
        return $table;
    }


//    protected $tableName = 'filedata';
//    protected $primaryKey = 'id';
//
//    const USERID = 100;
//    const SOURCE = 1;
}